﻿using UnityEngine;

namespace CornerMemo
{
    public static class UITools
    {
        /// <summary>
        /// 清除所有子物体
        /// </summary>
        public static void ClearChildAll(this Transform parent)
        {
            if (parent.childCount ==0)return;
            for (int i = parent.childCount-1; i >= 0; i--)
            {
#if UNITY_EDITOR
                Object.DestroyImmediate(parent.GetChild(i).gameObject);
#else
                Object.Destroy(parent.GetChild(i).gameObject);
#endif 
            }
        }
    }
}